-
Couldn't load subscription status.
- Fork 30
fix: Allow passing additional scopes to getAuthClient in examples helper function #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Allow passing additional scopes to getAuthClient in examples helper function #489
Conversation
examples/oauth/helper.ts
Outdated
| callback: "http://localhost:8080", | ||
| scopes: ["invoices:read", "account:read", "balance:read"], | ||
| scopes: [ | ||
| "invoices:read", // At least one scope is required to get an access token. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better if all examples pass the scopes they need? because then there isn't the case where they have this scope when they don't need it, or if we want to test a case where the token does not have read permissions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright.
yea, I wanted to follow that approach too, but I was trying to avoid having to add comments to most examples explaining that "invoice:read" isn’t actually required for the function, it’s just there because at least one permission needs to be passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dunsin-cyber I think all the examples do actually need a specific scope - for those other ones they do need the invoice:read scope (for example the webhook examples). Which one doesn't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes, exactly, i've made the fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
The OAuth scopes in
getAuthClientfound inexamples/oauth/helperwere previously hardcoded, making it inflexible. Adding new functionality that required different permissions, such as sending payments, necessitated modifying this core helper function directly.This change refactors the function to accept an optional
additionalScopesarray.Resolves: #488